package com.bookcloud.java21.chapter4.类的构建函数45;

public class TestPerson2 {
  public static void main(String[] args) {
    // 实例化Person2
    Person2 person2 = new Person2();
    // 调用有参构造函数
    Person2 person21 = new Person2("张三", 18, "男");
    // 打印出person21的姓名、年龄、性别
    System.out.println(
        "person21的姓名、年龄、性别："
            + person21.getName()
            + "、"
            + person21.getAge()
            + "、"
            + person21.getSex());
    // 调用重载构造函数
    Person2 person22 = new Person2("张三", 18);
    // 打印出person22的姓名、年龄
    System.out.println("person22的姓名、年龄：" + person22.getName() + "、" + person22.getAge());
    System.out.println("======================");
    // 调用有1个参重载构造函数
    Person2 person23 = new Person2("lisa");
    // 打印出person23的姓名、年龄
    System.out.println("person23的姓名、年龄：" + person23.getName() + "、" + person23.getAge());
  }
}
